package com.gmt.service;

import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

/**
 * @author John.zhang
 * @version Id: GmImportBeanDefinitionRegistrar, v 1.0 2020/11/10 19:43 ZhiYong Exp $
 */
public class GmImportBeanDefinitionRegistrar implements ImportBeanDefinitionRegistrar {

    /**
     * 提供IOC容器注册器，直接将需要注册的容器添加进去
     * @param importingClassMetadata
     * @param registry
     */
    @Override
    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata
            , BeanDefinitionRegistry registry) {
        RootBeanDefinition rootBeanDefinition = new RootBeanDefinition(CacheService.class);
        registry.registerBeanDefinition("CacheService",rootBeanDefinition);
    }
}
